package com.atguigu.admin.service.impl;

import com.atguigu.admin.bean.City;
import com.atguigu.admin.mapper.CityDao;
import com.atguigu.admin.service.CityService;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 杨林
 * @create 2023-09-02 10:37 星期六
 * description:
 */
@Service
public class CityServiceImpl implements CityService {
    
    @Autowired
    CityDao cityDao;

    Counter counter;
    public CityServiceImpl(MeterRegistry registry){
        counter = registry.counter("cityService.getCity.count");

    }
    
    @Override
    public City getCity(Integer id) {
        City city = cityDao.getCity(id);
        counter.increment();
        return city;
    }
}
